package com.xdtech.base.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.base.model.Province;

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-06-02 14:00:50
 * @since 1.0
 * @see
 */
public class ProvinceItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="名称",width=100)
	private String name;
	@GridColumn(title="编码",width=100)
	private String code;

	public void setId(Long id) {
		this.id = id;
		addQuerys("id", id);
	}
	public Long getId() {
		return id;
	}
	
	public void setName(String name) {
		this.name = name;
		addQuerys("name", name);
	}
	public String getName() {
		return name;
	}
	
	public void setCode(String code) {
		this.code = code;
		addQuerys("code", code);
	}
	public String getCode() {
		return code;
	}
	
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static ProvinceItem createItem(Province province) {
		ProvinceItem provinceItem = new ProvinceItem();
		BeanUtils.copyProperties(provinceItem, province);
		//自定义属性设置填充
		return provinceItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<ProvinceItem> createItems(List<Province> provinces) {
		List<ProvinceItem> provinceItems = new ArrayList<ProvinceItem>();
		for (Province province : provinces) {
			provinceItems.add(createItem(province));
		}
		return provinceItems;
	}
}
